<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\Resource;

class Game extends Resource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'unique_key' => $this->unique_key,
            'main_game_plat_code' => $this->main_game_plat_code,
            'cn_name' => $this->cn_name,
            'en_name' => $this->en_name,
            'pc_game_code' => $this->pc_game_code,
            'pc_game_deputy_code' => $this->pc_game_deputy_code,
            'mobile_game_code' => $this->mobile_game_code,
            'mobile_game_deputy_code' => $this->mobile_game_deputy_code,
            'record_match_code' => $this->record_match_code,
            'record_match_deputy_code' => $this->record_match_deputy_code,
            'img1' => $this->getImg1Url(),
            'img2' => $this->getImg2Url(),
            'type' => $this->gameType->name ?? '',
            'category' => $this->gameCategory->name ?? '',
            'line_num' => $this->gameLine->name ?? '',
            'able_demo' => $this->able_demo,
            'able_recommend' => $this->able_recommend,
            'is_lobby' => $this->is_lobby,
        ];
    }
}
